Skip to main content

What’s New

Qrvey 8.5
Version 8.5 (LTS) of the Qrvey platform is now available to customers. This version includes several new features and performance improvements.
Learn More
End-of-life Schedule
We've added a new article that lists the features and endpoints that have been scheduled for deprecation. All features and endpoints will be supported for (1) year after the release date of the LTS version that contains the alternative.
Learn More
NodeJS Deprecation
AWS has announced that it is deprecating NodeJS 12, 14, and 16. To avoid any issues as a result of this deprecation, upgrade your instances of the Qrvey platform as described in this announcement.
Learn More
Version: 8.5

Working With Filters in Embedded Scenarios

Qrvey provides a set of controls to create and interact with filters across the application to refine the data based on your needs. You can find more details about these controls in the portal section Working with Interactive Filters. When embedding Qrvey’s widgets into your system, you may run into situations where you need to combine Qrvey’s filters with your own set of filter controls. This article walks you through the steps that are needed for passing the values of your own filters to embedded Qrvey widgets.

You can pass values to Qrvey’s widgets to filter charts or pages depending on your needs using the Filter Object Structure, as described below. The structure is passed as part of the supported widget’s configuration object as “userFilters” and it can contain an array of filters with the default scope of global.

var config = {
attribute1: value1,
attribute2: value2,
...,
"userFilters": { "filters": [
...
]
}
}

This feature is available with Dashboard View, Dashboard Builder, Single Panel, and Analytic Suite widgets and you can find sample code in each of the mentioned articles.

Filter Object Structure

Filters Object

PropertyTypeRequiredDescription
operatorStringNoDefault AND. Each filter requires a boolean logic to refine the data based on the user’s criteria. Allowed values:
AND
OR
expressionsArrayYesIt’s a list of filter criteria to refine the data. Each item in the collection includes one or multiple Expressions Objects.

Expressions Object

PropertyTypeRequiredDescription
qrveyidStringNoRepresent the dataset ID used to refine the data.
questionidStringNoRepresent the dataset’s column ID used to refine the data, should belong to the qrvey defined above.
questionTypeStringYesIt’s only required if the column used to refine the data is a FORMULA or a BUCKET; otherwise, it is optional. Allowed values:
FORMULA
BUCKET
validationTypeStringYesThe field represents the operand for filtering. Allowed values:
EQUAL
NOT_EQUAL
CONTAIN
NOT_CONTAIN
END_WITH
NOT_END_WITH
START_WITH
NOT_START_WITH
RANGE
IS_EMPTY
* IS_NOT_EMPTY
propertyStringNoWhen using complex data types like the ones defined inside Webforms, Quizzes, or Surveys, it’s required. Please refer to Complex Properties for a complete list of supported values.
groupValueStringNoDefault ‘day’. Only applies when you want to group date values. Allowed values:
year
month
quarter
week
day
hour
minute
second
valueArrayYesList of values used to filter the data. Qrvey will return all the records that match the criteria defined in the filter. Depending on the column’s data type, you may require additional parameters.

Strings
"value": [
"United States"
]

Number or Date*
**lt**: Less than.*
**lte**: Less than or equalto.*
**gt**: Greater than.*
**gte**: Greater than or equal to.

"value": [
{
"gt": "10507.231"
}
]


"value": [
{
"lte": "11/30/2016",
"gte": "05/15/2014"
{"}"}
]

Complex Properties

PropertyOutputWeb Form Column Type
first_nameStringNAME
last_nameStringNAME
full_nameStringNAME
first_name_lowerStringNAME
last_name_lowerStringNAME
full_name_lowerStringNAME
skipped_questionStringNAME, ADDRESS, USADDRESS, LONGTEXT, TEXTFIELD, FILEUPLOAD, IMAGEUPLOAD, DATE, NUMERIC, RATING, SLIDEBAR, YES_NO, DROPDOWN, SINGLE_CHOICE, MULTIPLE_CHOICE, EXPRESSION, CHECKLIST, PASSWORD, EMAIL_FORM, RANKING, SIGNATURE, PHONE, IMAGE, LOOKUP
full_addressStringADDRESS, USADDRESS
countryStringADDRESS, USADDRESS
state_codeStringADDRESS, USADDRESS
stateStringADDRESS, USADDRESS
countryStringADDRESS, USADDRESS
state_nameStringADDRESS, USADDRESS
cityStringADDRESS, USADDRESS
postal_codeStringADDRESS, USADDRESS
zipStringADDRESS, USADDRESS
address_line_1StringADDRESS, USADDRESS
address_line_2StringADDRESS, USADDRESS
full_address_lowerStringADDRESS, USADDRESS
state_code_lowerStringADDRESS, USADDRESS
state_lowerStringADDRESS, USADDRESS
state_name_lowerStringADDRESS, USADDRESS
city_lowerStringADDRESS, USADDRESS
postal_code_lowerStringADDRESS, USADDRESS
zip_lowerStringADDRESS, USADDRESS
address_line_1_lowerStringADDRESS, USADDRESS
street_address_lowerStringADDRESS, USADDRESS
address_line_2_lowerStringADDRESS, USADDRESS
wordsStringLONGTEXT o TEXTFIELD, DROPDOWN, LOOKUP
entitiesStringLONGTEXT o TEXTFIELD
entitiestypeStringLONGTEXT o TEXTFIELD
sentimentStringLONGTEXT o TEXTFIELD
keywordsStringLONGTEXT o TEXTFIELD
filesizeNumericFILEUPLOAD, IMAGEUPLOAD
filetypeStringFILEUPLOAD, IMAGEUPLOAD
filenameStringFILEUPLOAD
fileurlStringFILEUPLOAD, IMAGEUPLOAD
all_detailsStringFILEUPLOAD, IMAGEUPLOAD
analysisStringIMAGEUPLOAD
yearNumericDATE
monthNumericDATE
dayNumericDATE
quarterNumericDATE
weekNumericDATE
hourNumericDATE
minuteNumericDATE
secondNumericDATE
valueStringNUMERIC
lowerStringDROPDOWN, SINGLE_CHOICE, MULTIPLE_CHOICE, LOOKUP
expression_typeStringEXPRESSION
local_partStringEMAIL_FORM
domainStringEMAIL_FORM
rank{{x}}StringRANKING. (x) denotes the ranking position.
signature_urlStringSIGNATURE
area_codeStringPHONE
answer_idStringIMAGE
display_fullStringLOOKUP
display_allStringLOOKUP
display_{{x}}StringLOOKUP. Show display with index (x)

Examples

Simple Filter

The following example shows the filter structure for a simple range filter on a numeric column:

Sample filter: COLUMN_ID BETWEEN 10 AND 15.

...
"userFilters": {
"filters": [
{
"operator": "AND",
"expressions": [
{
"qrveyid": "QRVEY_ID",
"questionid": "COLUMN_ID",
"validationType": "RANGE",
"value": [
{
"lte": 15,
"gte": 10
}
]
}
]
}
]
}

Filtering Multiple Columns

The following example shows the filter structure for three filters with different columns and conditions.

Sample filter:
COLUMN_ID_1 BETWEEN 05/15/2014
AND
11/30/2016
AND
COLUMN_ID_2 EQUAL ‘United States’ AND COLUMN_ID_3 GREATHER_THAN 10507.231

...
"userFilters": {
"filters": [
{
"operator": "AND",
"expressions": [
{
"qrveyid": "QRVEY_ID",
"groupValue": "day",
"questionid": "COLUMN_ID_1",
"validationType": "RANGE",
"value": [
{
"lte": "11/30/2016",
"gte": "05/15/2014"
}
]
},
{
"qrveyid": "QRVEY_ID",
"questionid": "COLUMN_ID_2",
"validationType": "EQUAL",
"value": ["United States"]
},
{
"qrveyid": "QRVEY_ID",
"questionid": "COLUMN_ID_3",
"validationType": "RANGE",
"value": [
{
"gt": "10507.231"
}
]
}
]
}
]
}